package top.itmeans.yes.service.impl;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import top.itmeans.yes.entity.Subject;
import top.itmeans.yes.mapper.SubjectMapper;
import top.itmeans.yes.service.SubjectService;

/**
 * <p>
 * 专题表 服务实现类
 * </p>
 *
 * @author Yiming.Cao
 * @since 2022-05-05
 */
@Service
public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> implements SubjectService {

    @Override
    public Page<Subject> page(String keyword, Integer pageNum, Integer pageSize) {
        Page<Subject> page = new Page<>(pageNum,pageSize);
        LambdaQueryWrapper<Subject> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.like(!StrUtil.isEmpty(keyword),Subject::getTitle,keyword);
        return this.page(page, queryWrapper);
    }
}
